 /* modified on 7,2011
  *
  */
 outscan(void){
            fclose(fpe);
            free((void *)hashp);
			 
        if(nerr){
                 printf("\n\n%d error%sdecteded in scan \n\n");
                 nerr,(nerr<2 ? " ":"s "));
                 fpe=fopen("$$err$$","rt");
				 
                while((c=getc(fpe))!=EOF){
					outch(c);
                } 
                 fclose(fpe);
                 puts("\n");
        }
            
		if(sopt>0){
				makename(fname,"sym",fsym);
				
                if((fps=fopen(fsym,"wt"))==(FILE*)NULL){
					printf("**can't open %s **",fsym);
					exit(1);
                }
				else{
                 fprintf(fps,"\t\t\t\tSymbol tables:%s\n",fname);
				}
                if(nrvar>0){
					fputs("\n\nreal variables\n\n",fps);
                            for(int i=0;i<nrvar;i++){
                                fprintf(fps,"%6d  %s \n",100+i,var[i]);
                                                
                            }
                }
                if(nivar>0) {
                    fputs("\n\ninteger variable \n\n",fps);
                    for(int i=0;i<nivar;i++){
                        fprintf(fps,"%6d %s\n",150+i,var[50+i]);
                    }             
                }
                if(nrlit>0){
                    fputs("\n\nreal literals\n\n",fps); 
                    for(int i=0;i<nrlit;i++){
                        fprintf(fps,"%6d%25.14e\n",200+i,(double)rlit[i]);
                    }
                }
                if(nilit>0){
                    fputs("\n\ninteger literals\n\n",fps);
                    for(int i=0;i<nilit;i++){
                        fprintf(fps,"%6d%15ld\n",250+i,nilit[i]);
                    }
                }
                if(nerr>0){
                    fprintf(fps,"\n\n%d error%s detected in scan\n\n",nerr,(neer<2 ? "":"s"));
                    fpe=fopen("$$err$$","rt");
                                                              
                    while(c=getc(fpe))!=EOF){
                        fputc(c,fps);
                    }
                    fclose(fpe);
                    fputs("\n",fps);
                }
				
                fprintf(fps,"\t\tintrnal form %d symboles\n\n",nsymb);
				
                for(int i=0;i<nsymb;i++){
                        k=symbol[i];
                        if(400<k){
                            fprintf(fps,"\n%6d",k);
                            j=0;  
                        }
						else{
							if(SYMLIN<++j) {
                                fprintf(fps,"\n");
                                j=1;
                            } 
                            fprintf("fps,"%5d",k);
                        }
				}
                fputc((int)NEWL,fps));
                fclose(fps);
                a:                                  
                if(unlink("$$err$$")!=0){
                         puts("**cannot delete \"$$err$$\"**");       
                }
			else{
                goto a;                                               
            }
		}
    }                
            
            
                
                 
                       
                 
                       
